UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PKyCAsY9JyFnw56MrtvPsY+egcvKJsdu+KmZUW0Zshk=' 
WHERE 
  key_id = 'af93a7f1e2b407c88ff0212273a6c076a300ae8332ec337e8bbbb2d2586a174b' 
  AND (
    token = 'PKyCAsY9JyFnw56MrtvPsY+egcvKJsdu+KmZUW0Zshk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032