UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kuYSVarlRM7MEmysNWDJ1ex3yfLIfESFL6BDlifuVdk='
WHERE
key_id = '7c0254d81dfb82cd0af8d4b322f3a9d2caea99c69bd8e43f1ecf74639b387417'
AND (
token = 'kuYSVarlRM7MEmysNWDJ1ex3yfLIfESFL6BDlifuVdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)