UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HQHxt7d0UrqTKKI+10zXPLgbRbbH0mSvwOBvY04Ih1w=' 
WHERE 
  key_id = '308a108252bc4d33a83cae716c7f4d68281de7b3ee1e1864f113739ede23a97a' 
  AND (
    token = 'HQHxt7d0UrqTKKI+10zXPLgbRbbH0mSvwOBvY04Ih1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014