UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tYWWMZSGsnO0WxrBtRwE/5OZfQ3cpmuuFO59Lf8qVHc='
WHERE
key_id = '1e5f394886151885e5be1d96d5b937a79e56f5738acd58ce031b5cb7eec1abd1'
AND (
token = 'tYWWMZSGsnO0WxrBtRwE/5OZfQ3cpmuuFO59Lf8qVHc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)