UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vv6DGqnIV+iYum/wFLvMZuytrA6uWzNE0NmvKeryk2Y=' 
WHERE 
  key_id = '616eece87b503d5e766fcc62daaa414165c2ff974081f4a62ce13d2b3515abcc' 
  AND (
    token = 'Vv6DGqnIV+iYum/wFLvMZuytrA6uWzNE0NmvKeryk2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023