UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+/O1TIJrSOKgCqx/prYiviIKEJpiqItuAii77TlkRI=' 
WHERE 
  key_id = 'd707b3d96d45c020f31d8f2099d9f6cc653653012060f3a4f55f597086daedfc' 
  AND (
    token = 'c+/O1TIJrSOKgCqx/prYiviIKEJpiqItuAii77TlkRI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022