UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fCS7cBg2vP4clJT3qPsI0dR+jfkCrjSWnY/w3M6eLdw=' 
WHERE 
  key_id = '37d390af4acd76b2e94562cf03b989098cd8c8931033f9cb7eda3bdf82ba3d0e' 
  AND (
    token = 'fCS7cBg2vP4clJT3qPsI0dR+jfkCrjSWnY/w3M6eLdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040