UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Y9gWlCtdeTC1NmYOfvkf53JWSjVIxloS4epxmewB/s='
WHERE
key_id = 'd8046ae1e04517e84c06e76301268f893a7354b274b57088db1f562187e34dae'
AND (
token = '2Y9gWlCtdeTC1NmYOfvkf53JWSjVIxloS4epxmewB/s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)