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