UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hLwuiA0Le108wNyCyhq+W2YNZ/jL6l1Ob3z5NL0Jaik=' 
WHERE 
  key_id = 'ddc70101a43f2b7398186dfc7ffb595c1279870ee6ca95369d04fca868162c24' 
  AND (
    token = 'hLwuiA0Le108wNyCyhq+W2YNZ/jL6l1Ob3z5NL0Jaik=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032