UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hQCXhFXBW+C6ETNBSe4WtnP6BaHs7PmQRpWpEyyenQE=' 
WHERE 
  key_id = '7f475dffba7f46d02879647bdc8e01262a71237f598cae609480da26d061d2ea' 
  AND (
    token = 'hQCXhFXBW+C6ETNBSe4WtnP6BaHs7PmQRpWpEyyenQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024