UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OATxQReBVmPPMnfaieGJ1xdKAY5ow0NzX6DleY+584g=' 
WHERE 
  key_id = '9c1276e733410e90517d71562a748ecb49310876046f125ec051d551f74b5f81' 
  AND (
    token = 'OATxQReBVmPPMnfaieGJ1xdKAY5ow0NzX6DleY+584g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032