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