UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/7VGc+NKcIJViOpkOk47qcEMqu0nUhpoihBira/vYGs=' 
WHERE 
  key_id = 'a334803b34f40aa1fecf7ce0796c7d881549873b779f1dc55a1365c1470352b1' 
  AND (
    token = '/7VGc+NKcIJViOpkOk47qcEMqu0nUhpoihBira/vYGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025