UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4x3odS0RmyXGQE5YaXdxt5UOeBaztu7JHEjaiOAXtYo='
WHERE
key_id = '6ee2eb62bf01e884311cf5c784e91178d6b243151c2f32f83af235a19e9df6c5'
AND (
token = '4x3odS0RmyXGQE5YaXdxt5UOeBaztu7JHEjaiOAXtYo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)