UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TTXeEig5/OoSsi33k+BTLrw+/XdAgza6PSuQr0ApdAk='
WHERE
key_id = 'd2d4fa791bf115b64ab8e30f05dfc0ffb5e7cab744e7dbb8642ec0ea47e1a388'
AND (
token = 'TTXeEig5/OoSsi33k+BTLrw+/XdAgza6PSuQr0ApdAk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)