UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7aGycQDABoTCm1UI01VuWJrYDRIWrH9S7d5H8xH+NM=' 
WHERE 
  key_id = '84d0de684db4fc5e28c88f34a9a050c0f3c69942bbd963791a51242d8e35afa2' 
  AND (
    token = 'f7aGycQDABoTCm1UI01VuWJrYDRIWrH9S7d5H8xH+NM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032