UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r6y8woUFuwAROw5CPrElJZ8T6O34O+1XqrZRWedg5FU=' 
WHERE 
  key_id = '2567698f833d025c8ae6f887e46faf21930f26fcbe25faa03eac29b92316c2e0' 
  AND (
    token = 'r6y8woUFuwAROw5CPrElJZ8T6O34O+1XqrZRWedg5FU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060