UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w1v9LKuA6zVF/wzI7lH29a3xpmI50boxa1f3rWlMpXs='
WHERE
key_id = 'c9ce3d81ff6a486f1cb6fee63def998326a54bfe83224bfca60e9d0df7e476e4'
AND (
token = 'w1v9LKuA6zVF/wzI7lH29a3xpmI50boxa1f3rWlMpXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)