UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kFI1dKgPalfo37GcWsRHgNG+76/NfOtphWthd2aJG+E=' 
WHERE 
  key_id = 'a097c22778e20638a6964be9f5e5d69ae2b4ea5f8727a527fdc62a652e54c508' 
  AND (
    token = 'kFI1dKgPalfo37GcWsRHgNG+76/NfOtphWthd2aJG+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030