UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5WTSekLWFMAWL56lNbE3lFLLN0frOq8HMcgNYWUkprs=' 
WHERE 
  key_id = '83e8064fe806d961f9945340cf8f39e2ca0613c5ac665f96e248a45dede0534c' 
  AND (
    token = '5WTSekLWFMAWL56lNbE3lFLLN0frOq8HMcgNYWUkprs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029