UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ufaUTnpUpCCUiiCIw3aijMj58qbZS03OXyHrmJ9Rx1g=' 
WHERE 
  key_id = 'b89ab3efffda4cdc0dd2bb7aad1621ca6321b558f13476bbb481fb7e2aab8dfe' 
  AND (
    token = 'ufaUTnpUpCCUiiCIw3aijMj58qbZS03OXyHrmJ9Rx1g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016