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

Query time 0.00044