UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kYy6KyGpwqDkUpEPcVQVgUzm45qhhb8kwFzgrv8pN4c=' 
WHERE 
  key_id = '1002a50c00746985ffee2f2af020aaccbd13b0af017c0c55fcf8efe93b80f026' 
  AND (
    token = 'kYy6KyGpwqDkUpEPcVQVgUzm45qhhb8kwFzgrv8pN4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017