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