UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GUawdAlhG+pv8FMD0VhZBQup9joYpjN6oApClRq4HqE=' 
WHERE 
  key_id = '3a08d78cd0d5a9dfe35e5970f0ec5187086d6319b4d7903d005d6d1e2e1b2df8' 
  AND (
    token = 'GUawdAlhG+pv8FMD0VhZBQup9joYpjN6oApClRq4HqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027