UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PNQ1cS7mz8a+yGOEKPqEVNqT3S6Hd1KS46VqX5PJ7jE=' 
WHERE 
  key_id = 'dfd5515a72aece407251c5efe1df83f47493cd7841b7ca6af0052e194e59ccbb' 
  AND (
    token = 'PNQ1cS7mz8a+yGOEKPqEVNqT3S6Hd1KS46VqX5PJ7jE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033