UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wIqbK46Ind4RxBG5iLcHA4nUeLruw39naads8+uC7xc='
WHERE
key_id = 'dec28141154afd2e76db6b16f0d887ba3779d166f1f38e49dcf874713fe7fe18'
AND (
token = 'wIqbK46Ind4RxBG5iLcHA4nUeLruw39naads8+uC7xc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)