UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'juTJMi5ivjR6OrA5bFGpijp7kO6ylEHODaj1KwLHvuM='
WHERE
key_id = '6ec094d2c85616d9629dbcd2c418946ebe10c9df7b048a9f3ef203ff0ab4ad5c'
AND (
token = 'juTJMi5ivjR6OrA5bFGpijp7kO6ylEHODaj1KwLHvuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)