UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm5DFe8HFmjZcXbUZ5eU80B4gb6J9FzMiNlKZpvOcdxs=' 
WHERE 
  key_id = 'c41202fccacb2eb8c5a2999b880d6bd9a00c597f514ea0998f08638d15afdff5' 
  AND (
    token = 'm5DFe8HFmjZcXbUZ5eU80B4gb6J9FzMiNlKZpvOcdxs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025