UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bUINX4QV0BA7dEaZkLJ7EMSK5gtolvbAQsRkYK906zs=' 
WHERE 
  key_id = '1eafc448cea5d44099fc896561d79488847661fc0b487d50d464d1eafe84b8f9' 
  AND (
    token = 'bUINX4QV0BA7dEaZkLJ7EMSK5gtolvbAQsRkYK906zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00172