UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9wlZM1qL/l92TYwJDaqA5mknpwfZ7e+09K/4agsq8Hk='
WHERE
key_id = '38f8a202e33b4fac694ff1b9bfc958515249612f9faa6da007b0311e0cc100f6'
AND (
token = '9wlZM1qL/l92TYwJDaqA5mknpwfZ7e+09K/4agsq8Hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)