UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BmL9vqDBInsMOjYUyJQmf+LBsuCinLPvSvdzOMaK+kM='
WHERE
key_id = '7ac1d1766a6e37f13d951567683760b06e2586a706beb62b9eb0182f7b257fee'
AND (
token = 'BmL9vqDBInsMOjYUyJQmf+LBsuCinLPvSvdzOMaK+kM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)