UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQSA7VPEs2QDtRYu6Tn4eV6UNFqpbAJeyczEHxc5wIQ=' 
WHERE 
  key_id = '140b7a4efd46e450efb7f0998ce25912048454f3be47f3f322aa55abb9222433' 
  AND (
    token = 'PQSA7VPEs2QDtRYu6Tn4eV6UNFqpbAJeyczEHxc5wIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044