UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VRhAH8/K6WsuqJCSV2BjOHqpbm7Hufgvkf2w233Ka7o=' 
WHERE 
  key_id = '799368eed3cc986a5e0b7ce894d6d38e15774684232b26f188e72cbdc431600c' 
  AND (
    token = 'VRhAH8/K6WsuqJCSV2BjOHqpbm7Hufgvkf2w233Ka7o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045