UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uxNKX6k8BnU7vtsQbFVutybOdp32azvpomviAkMT1M0='
WHERE
key_id = '858f283f1e43768259b4da0d33da68312c5002d5651f0278d0c16a8594dbd629'
AND (
token = 'uxNKX6k8BnU7vtsQbFVutybOdp32azvpomviAkMT1M0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)