UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aQDnUeo+810C/khQu112G22QSLf0u4RBAfle6k+vxes=' 
WHERE 
  key_id = '061000c9c8102b46edddcd0f901f6aecb3f7dedb7e9c1e0dfaf9513a87f6afdc' 
  AND (
    token = 'aQDnUeo+810C/khQu112G22QSLf0u4RBAfle6k+vxes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032