UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZO46Wh6qoF08ww70id1o3KOOxu6qzlMWANtjNoXqKH0='
WHERE
key_id = '671c4816148eacf85c92dbce44a93ccba3666bfb9d5120f9fd6f75ac42a30d0f'
AND (
token = 'ZO46Wh6qoF08ww70id1o3KOOxu6qzlMWANtjNoXqKH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)