UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SGOqW4NSUSDGuOcOC+2PcXDxvxPRs5bxVsCZia+Ya4=' 
WHERE 
  key_id = '8cc524cfa3fedfa1d237c5a296b4961b0bd04ef8df46707a95f66d6279eccf98' 
  AND (
    token = '8SGOqW4NSUSDGuOcOC+2PcXDxvxPRs5bxVsCZia+Ya4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038