UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PuiCbcz0iXeO2yyoxYRNsF8n/25cdCKyVxOisB6Kpwk='
WHERE
key_id = '901eb3a8980243f4c0be74247528711b4350a1cd454746316ec58311a34fc4fd'
AND (
token = 'PuiCbcz0iXeO2yyoxYRNsF8n/25cdCKyVxOisB6Kpwk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)