UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0LC7jw7N0jtHt8Rj+kwUrvCETKXn2tr6SZYp83rcyxc='
WHERE
key_id = '328d18d746849930137ea54e1edcbb690ed067bc189927c686222b5b1fd88e1d'
AND (
token = '0LC7jw7N0jtHt8Rj+kwUrvCETKXn2tr6SZYp83rcyxc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)