UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3qvtrZtLvjDjhs08iw3KYf9XKWCWEk+xKuzRsPQy3B4=' 
WHERE 
  key_id = '8036bcd31327984b2070532101fb46c3eea609e32e718f8ca9e8607f9517ade6' 
  AND (
    token = '3qvtrZtLvjDjhs08iw3KYf9XKWCWEk+xKuzRsPQy3B4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040