UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xhhuHAWmRsS4Y52mjFhO7Hv7H4s4ujsB6NuS9e8uqu0=' 
WHERE 
  key_id = '4091512592323093e211e0368b42cc3f866accde7763ea055fd97e837f6b0943' 
  AND (
    token = 'xhhuHAWmRsS4Y52mjFhO7Hv7H4s4ujsB6NuS9e8uqu0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044