UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FItQmeFkGp0aZ+lI/iQDdWKd+IiBoAKeVw8Ga6cNLpU=' 
WHERE 
  key_id = '764e9559bf4408571de257f1642067339a57519d268592c6d92c187a1906ce3b' 
  AND (
    token = 'FItQmeFkGp0aZ+lI/iQDdWKd+IiBoAKeVw8Ga6cNLpU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054