UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6Y2JtYOsh2yzCEa/KrK73CuO7BM17dNpZLz7iAFqHp0='
WHERE
key_id = 'ff50917d6d9866da193ede689da12a45a44e6179c0c488d37385dcd228175eed'
AND (
token = '6Y2JtYOsh2yzCEa/KrK73CuO7BM17dNpZLz7iAFqHp0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)