UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's5C+sVt3SqbANpPQbpwq6CIKX8nnw5J0cNGqnchwHKY=' 
WHERE 
  key_id = '2278ad9d1d27d4a74fc620086376406581d169ca149cda7b1b4c41ac31afe727' 
  AND (
    token = 's5C+sVt3SqbANpPQbpwq6CIKX8nnw5J0cNGqnchwHKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018