UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ahokh8XhNkF23imzsANrhnAcrP57x5cvTFYHyO9QN8A=' 
WHERE 
  key_id = '18935492ebd96866b6846301bbf1d9c99e8449e5aad31f801f75aa473dd5a730' 
  AND (
    token = 'ahokh8XhNkF23imzsANrhnAcrP57x5cvTFYHyO9QN8A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024