UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hYzVG15/JnhdKGZSdl0PjQPg0mxm+ON9OXgyMnG1GsM='
WHERE
key_id = 'c4956b2a159fc5940eb1fd87517f5b7ce82541b802db01e97480a71189e9fc38'
AND (
token = 'hYzVG15/JnhdKGZSdl0PjQPg0mxm+ON9OXgyMnG1GsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)