UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BZQp48Kizkuc2xF7h+/n+btXm1I45GHcY1ywx+guIX8='
WHERE
key_id = '844fe7331834f4dae3adda3ffbfd15504d0c2dc313a230deb87dc4394e0f9b9a'
AND (
token = 'BZQp48Kizkuc2xF7h+/n+btXm1I45GHcY1ywx+guIX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)