UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X5tHtr8TwPIzsWrALdKI8j36G6HNN0pEuMnAsgSnACA=' 
WHERE 
  key_id = '77bc8063956106aac59e21c8fb4efe5899ed7b566fbcb427ad62cbf568051f44' 
  AND (
    token = 'X5tHtr8TwPIzsWrALdKI8j36G6HNN0pEuMnAsgSnACA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040