UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tgWKRdGc1HOq2YxkzgzJb1G0aN4107ZbJWe+jgEwLAo=' 
WHERE 
  key_id = 'dd3ee40611001e3e6bf651aa95932ef7d87989f93d1ad95455b848ef2c006bca' 
  AND (
    token = 'tgWKRdGc1HOq2YxkzgzJb1G0aN4107ZbJWe+jgEwLAo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037