UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SHjZFUZR1o3oj3BwKCbUYmrrC60V/MfP6YyQtDigPyA=' 
WHERE 
  key_id = '679fe2a8cc82a6349424995fedf13c70effcaf2e05c23a5809e818895372694d' 
  AND (
    token = 'SHjZFUZR1o3oj3BwKCbUYmrrC60V/MfP6YyQtDigPyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042