UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'acREQKcL3qSvAMXdB1cmX9tgpALOv8Vww3SfvkgkZMY=' 
WHERE 
  key_id = 'c027f097b20d667a62273ec81fe84292138d23f987c9961e9a2313a13d3b84b9' 
  AND (
    token = 'acREQKcL3qSvAMXdB1cmX9tgpALOv8Vww3SfvkgkZMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032