UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dSMck2kBm0VmvTw3P7Xlw4bMFpraG3tvWy2pqcXA1Z8=' 
WHERE 
  key_id = 'f922b30939c080813a7132f85eec779bcec88184b96dcff1b28a51a824ffcaf4' 
  AND (
    token = 'dSMck2kBm0VmvTw3P7Xlw4bMFpraG3tvWy2pqcXA1Z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027