UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y1bN+9arQs66o0lcjKMIXxdfiA0ni38W7KfyvVWlMVE='
WHERE
key_id = 'b7ba934f0fbe280ae181ebc363867a5e771eebc4b0eb3d3968ae56dd6c63909b'
AND (
token = 'Y1bN+9arQs66o0lcjKMIXxdfiA0ni38W7KfyvVWlMVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)