UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'idBSVjyAzpYibYvgQ41scC82B11/nO/HH7hbSx75rVc=' 
WHERE 
  key_id = '467866d8ea70cf184f9e574a215322348a3bdfbbea760879efcec9acf618474f' 
  AND (
    token = 'idBSVjyAzpYibYvgQ41scC82B11/nO/HH7hbSx75rVc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030