UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZspwX93j3IC/vpNZhrM8adouOUjbD0zKX/WWthCmGDA=' 
WHERE 
  key_id = 'a0252910c1d769df7f7671fa3b4eb8a8659d659361dcb1596120aca1749adef4' 
  AND (
    token = 'ZspwX93j3IC/vpNZhrM8adouOUjbD0zKX/WWthCmGDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032