UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ly23eb86+Jsc3YVH4WpNkR/NqRY+SDaKnCyd1LIuNuw='
WHERE
key_id = 'c400e8879b531a754dd300628cd377a3ea8672c281b638e65433d2fbcc65b2dc'
AND (
token = 'Ly23eb86+Jsc3YVH4WpNkR/NqRY+SDaKnCyd1LIuNuw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)