UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B+5MEdkYozdwkwQPLLtwCCHHgQ/bocHu0gBi0Ed5w8E=' 
WHERE 
  key_id = '708556071b42895c7e0b4d03811cd3ae32f828209b7ca29d875671b084d2944c' 
  AND (
    token = 'B+5MEdkYozdwkwQPLLtwCCHHgQ/bocHu0gBi0Ed5w8E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032