UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SiGWgszcL+wObSCKJgNJqUhOX12CFAKw0B5SG0anc2s=' 
WHERE 
  key_id = 'a06ee735114c89e33e7e5f5244201836d66de9f309f33e28be816b7ceaaa630b' 
  AND (
    token = 'SiGWgszcL+wObSCKJgNJqUhOX12CFAKw0B5SG0anc2s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038