UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YFMe7ZnwMqldQmVF+y7cqXDO1EkRj7w6QfmGrYnz0qk=' 
WHERE 
  key_id = '5826203eb4ad36e80f19e6e2097839cfc59165058d345f33cebc60e45a917829' 
  AND (
    token = 'YFMe7ZnwMqldQmVF+y7cqXDO1EkRj7w6QfmGrYnz0qk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030